import { request } from "@/utils/service"
import type * as Order from "./types/order"
import { getToken } from "@/utils/cache/cookies"
import axios from "axios"
const baseURL = import.meta.env.VITE_BASE_API
/** 增 */
export function createOrderDataApi(data: Order.ICreateOrderRequestData, uid: any, isHj: any) {
  return request({
    url: isHj ? `order/addHeJi?uid=${uid}` : `order/add?uid=${uid}`,
    method: "post",
    data
  })
}
/**h5下单 */
export function createOrderH5DataApi(data: any) {
  return request({
    url: `api/order/submit`,
    method: "post",
    data
  })
}
/**查询订单信息 */
export function getOrderInfo(id: any) {
  return request({
    url: `/order/billQueryState/${id}`,
    method: "get"
  })
}

/** 删 */
// export function deleteOrderDataApi(id: string) {
//   return request({
//     url: "order/del",
//     method: "delete",
//     params: {
//       id
//     }
//   })
// }

/** 重提 */
export function updateOrderDataApi(data: Order.IUpdateOrderRequestData) {
  return request({
    url: "order/update",
    method: "put",
    data
  })
}
// 再次修改
export function updateOrderDataApiZc(data: any) {
  return request({
    url: "order/updateSubmit",
    method: "put",
    data
  })
}
/** 修改 */
export function update1OrderDataApi(data: Order.IUpdateOrderRequestData) {
  return request({
    url: "order/cover",
    method: "post",
    data
  })
}

/** 查 */
export function getOrderDataApi(params: Order.IGetOrderRequestData) {
  return request<Order.GetOrderResponseData>({
    url: "order/query",
    method: "get",
    params
  })
}

export function getOrderH5DataApi(data: any) {
  return request({
    url: "/api/order/query",
    method: "post",
    data
  })
}
/**图片上传 */
export function uploadCidImageList(data: any) {
  return request({
    url: "order/image/upload",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
      token: getToken()
    },
    data
  })
}
export function getOrderOneApi(params: any) {
  return request<Order.GetOrderResponseData>({
    url: "order/detailed",
    method: "get",
    params
  })
}
/**下载 */
export function downLoadOrderTable(data: any) {
  return axios({
    url: `${baseURL}/order/downOrder`,
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
      token: getToken()
    },
    data,
    responseType: "blob"
  })
}
/**获取订单状态code */
export function getOrdeCode() {
  return request<Order.GetOrderResponseData>({
    url: "order/getAllState",
    method: "get"
  })
}

//批量重推

export function againPush(data: any) {
  return request({
    url: "order/batchBack",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
      token: getToken()
    },
    data
  })
}
// 所有人修改订单备注 /order/updateRemark
export function updateRemark(data: any) {
  return request({
    url: "order/updateRemark",
    method: "put",
    data
  })
}
// 查询修改订单备注日志 /remarkLog/query
export function remarkLog(params: any) {
  return request({
    url: "/remarkLog/query",
    method: "get",
    params
  })
}

//订单话费 相关导出
export function downLoadPb(params: any) {
  return axios({
    url: `${baseURL}/order/excel/list2`,
    method: "get",
    headers: {
      "Content-Type": "multipart/form-data",
      token: getToken()
    },
    params,
    responseType: "blob"
  })
}

//轮转日志
export function rationLog(params: any) {
  return request({
    url: "/order/packageHeJiLog/query",
    method: "get",
    params
  })
}
//身份证图片
export function getOrderCardIdApi(id: any) {
  return request({
    url: `/H5/share/queryImg/${id}`,
    method: "post"
  })
}
/**查询抖音直播间ID */
export function getDyLive(params: any) {
  return request<any>({
    url: "/dyLive/queryAll",
    method: "get",
    params
  })
}
//b站数据转化
export function biliDataChange(params: any) {
  return request<any>({
    url: "/api/back/bilibili",
    method: "get",
    params
  })
}
/**查询推荐套餐 */
export function getRecommendH5List(params: any) {
  return request<any>({
    url: "/h5/packTjInfo/queryTjPack",
    method: "get",
    params
  })
}
export function getRecommendH5List2(params: any) {
  return request<any>({
    url: "/h5/packTjInfo/queryTjPack2",
    method: "get",
    params
  })
}
/**切换记录 */
export function getChangeRecord(params: any) {
  return request<any>({
    url: "/h5/PackLog/query",
    method: "get",
    params
  })
}

/**批量转单 */
export function changeComboPl(data: any) {
  return request({
    url: "/order/batchUpdateSku",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
      token: getToken()
    },
    data
  })
}
/**批量原单提交 */
export function revisitEffect(data: any) {
  return request({
    url: "/order/pLUSubmit",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
      token: getToken()
    },
    data
  })
}
